<template>
  <div class="app2">
    <h1>App2</h1>
    <form @submit.prevent>
      <div>
        <input
          v-model.trim="message"
          placeholder="edit me"
        >
        <!--      @change="onValChange"-->
        <!--      <textarea v-model.lazy.number="message" placeholder="edit me"></textarea>-->
        <br>
        {{typeof message}}
      </div>
      <div>
        <!--      <input type="checkbox" id="checkbox" v-model="checked">-->
        <!--      <label for="checkbox">{{ checked }}</label>-->
        <input type="checkbox" id="jack" value="Jack" v-model="checkedNames">
        <label for="jack">Jack</label>
        <input type="checkbox" id="john" value="John" v-model="checkedNames">
        <label for="john">John</label>
        <input type="checkbox" id="mike" value="Mike" v-model="checkedNames">
        <label for="mike">Mike</label>
        <br>
        <span>Checked names: {{ checkedNames }}</span>
      </div>
      <div>
        <input type="radio" id="one" value="One" v-model="picked">
        <label for="one">One</label>
        <br>
        <input type="radio" id="two" value="Two" v-model="picked">
        <label for="two">Two</label>
        <br>
        <span>Picked: {{ picked }}</span>
      </div>
      <div>
        <select multiple v-model="selected">
          <option disabled value="">请选择</option>
          <option value="aaa">A</option>
          <option value="bbb">B</option>
          <option>C</option>
        </select>
        <span>Selected: {{ selected }}</span>
      </div>
      <div>
        <input
          type="checkbox"
          v-model="toggle"
          true-value="yes"
          false-value="no"
        >
        {{ toggle }}
      </div>
      <button>submit</button>
    </form>
  </div>
</template>

<script>
export default {
  name: 'App2',
  data() {
    return {
      toggle: '',
      selected: [],
      picked: 'One',
      checked: false,
      checkedNames: [],
      message: '',
    }
  },
  methods: {
    onValChange() {
      console.log(this.message)
    }
  }

}
</script>